package com.futao.springbootlearn20220224.condition;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Profiles;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * 判断是否激活了default profile
 *
 * @author futao@gmail.com
 * @date 2022/3/9
 */
public class DefaultCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        return context.getEnvironment().acceptsProfiles(Profiles.of("default"));
    }
}
